package priv.work2;

import java.io.IOException;
import java.io.OutputStream;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

@Configuration
@ImportResource(locations="app.cfg.xml")
public class MyConfig {
	@SuppressWarnings("resource")
	public static void main(String [] args) {
		ApplicationContext context = 
				new AnnotationConfigApplicationContext(MyConfig.class);
		
		OutputStream bean1 = context.getBean(OutputStream.class);
		String str = "today is goodday\r\n" + 
				"the cloud is not found\r\n" + 
				"the air is soo cold\r\n" + 
				"my foot quik missing";
		try {
			bean1.write(str.getBytes());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		XiaoMing bean2 = context.getBean(XiaoMing.class);
		System.out.println(bean2);
	}

}
